<!DOCTYPE html>
<html>
<head>
<title>餐桌编辑</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
    <script src="/static/layer/layer/layer.js"></script>

</head>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;"  >
    <h2>餐桌编辑</h2>
    <form method="post" action="/index.php/table/edit">

      <input type="hidden" name="id" id="id" value="{$data.id}" />

      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">名称编号(Name):</label>
        <input type="text" class="form-control" id="name" name="name" value="{$data.name}" placeholder="Goods name" />
      </div>
      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">适用人数(Number):</label>
        <input type="number" class="form-control" id="num_of_p" name="num_of_p" value="{$data.num_of_p}" placeholder="适用人数" />
      </div>    
      <div class="mb-3">
        <label for="title" class="form-label">说明(Title):</label>
        <input type="text" class="form-control" id="title" name="title" value="{$data.title}" placeholder="Title" />
      </div>


      <div class="mb-3">
        <label for="status" class="form-label">桌子款式:</label>

        <input type="radio" class="form-check-input" id="radio3" name="type" value="1" {if $data.type==1} checked {/if}/> 
        <label class="form-check-label" for="radio3">圆桌</label>

        <input type="radio" class="form-check-input" id="radio4" name="type" value="2" {if $data.type==2} checked {/if}/>
        <label class="form-check-label" for="radio4">方桌</label>

        <input type="radio" class="form-check-input" id="radio5" name="type" value="3" {if $data.type==3} checked {/if}/>
        <label class="form-check-label" for="radio5">卡座</label>   

        <input type="radio" class="form-check-input" id="radio6" name="type" value="4" {if $data.type==4} checked {/if}/>
        <label class="form-check-label" for="radio5">包厢</label>  
       </div>

      <div class="mb-3">
        <label for="status" class="form-label">是否启用(Using):</label>
          <input type="radio" class="form-check-input" id="radio1" name="status" value="1" {if $data.status==1} checked {/if}/> 
          <label class="form-check-label" for="radio1">启用(Using)</label>
          <input type="radio" class="form-check-input" id="radio2" name="status" value="2" {if $data.status==2} checked {/if}/>
          <label class="form-check-label" for="radio2">停用(Stoped)</label>
       </div>
      <button  type="button" class="btn btn-primary" onclick="doSave()">保存(Save)</button>

    </form>
    </div>

<script type="text/javascript">
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的名称(Invalid name)!");
        return 0;
      }    
      //询问框
      layer.confirm('是否确定保存?', {
        btn: ['YES','CANCEL'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });
    }

</script>


</body>
</html>
